package com.second.hand.trading.server.utils;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@AllArgsConstructor
@Getter
@Setter
public class R<T> {

    private Integer code;
    private T data;
    private String msg;


    public static <T> R<T> success() {
        return new R<>(200, null, "操作成功");
    }
    public static <T> R<T> success(T data) {
        return new R<>(200, data, "操作成功");
    }

    public static <T> R<T> fail() {
        return new R<>(500, null, "操作失败");
    }
    public static <T> R<T> fail(String msg) {
        return new R<>(500, null, msg);
    }
}
